package com.peanut.pojo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

import javax.annotation.Resource;

/**
 * @author chenhs
 * @date 2021/4/11
 */
public class Person {
	
	private  String name;
	
	private  Integer age;
	// required = false 表示这个属性可以为空
	@Autowired( required = false)
	@Qualifier(value = "dog")
	private  Dog dog;
	@Resource(name="cat")
	private  Cat cat;
	
	public  void  play() {
		dog.shout();
		cat.shout();
	}
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public Integer getAge() {
		return age;
	}
	
	public void setAge(Integer age) {
		this.age = age;
	}
}
